import java.util.Arrays;

public class MiningNobel
 {
	// return number of distinct 4-tuples (i, j, k, l) such that a[i] + a[j] + a[k] + a[l] = 0
	public static int countFast(double[] a) {
		int N = a.length;
		Arrays.sort(a);
		int cnt = 0;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				for (int k = 0; k < N; k++) {
					int l = Arrays.binarySearch(a, -(a[i] + a[j] + a[k]));
					if(l>=0) cnt++;
				}
			}
		}
		return cnt;
	} 

	public static void main(String[] args)  {
		Stopwatch watch = new Stopwatch();
		System.out.println("Start");
		String d = "";
		while(StdIn.hasNextLine()){
			String s = StdIn.readLine();
			d += s.split(",")[1]+",";
		}
		String[] b = d.split(",");
		double[] a = new double[b.length];
		for(int i = 0; i < b.length; i++) { a[i]=Double.parseDouble(b[i]); }


		System.out.println("Array filled");
		System.out.println("Starting count...");
		int cnt = countFast(a);
		StdOut.println("Found: " + cnt);
		System.out.println("Time used: " + watch.elapsedTime());
		System.out.println("Done");
	} 
} 
